<?php
/**
 * It is basic class of all controllers.
 * @author xu_zhang
 *
 */
require_once(APP.'libs'.DS.'system_properties.php');
class AppController extends Controller
{
	var $layout='';
	function beforeFilter(){
		session_start();

		// not need to login
		if ('product' == $this->params['controller'] && 'captcha' == $this->params['action']){
			return ;
		}

		if(empty($_SESSION['admin_user_id'])){
			//!!!
			//echo $this->params['controller'];
			
			//for reader guest
			if (strtolower($this->params['controller']) == 'product' && (strtolower($this->params['action'])=='showclicklogs' || strtolower($this->params['action'])=='showmyproductlist')){
				
				if(empty($_SESSION['guest_user_id'])){
					$this->redirect(SystemProperties::$app_host."/Logins/login/1");
					return;
				}
				
			}else {
				$this->redirect(SystemProperties::$app_host."/Logins/login/1");
				return;
			}
			
		}
		

	}
	

}
?>
